-
-
Notifications
You must be signed in to change notification settings - Fork 491
Reduce stdout edge cases #297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ce5c072 to
ae002ff
Compare
ae002ff to
6f05127
Compare
e4baf20 to
2e474b3
Compare
|
@AndrewSouthpaw / @PeterDaveHello i have added logic to ensure --stdout is only used on a single file to help explain the use case for using stdout. Further improvements will come via seperate pr. |
|
@AndrewSouthpaw any concerns with reducing the edge cases with stdout? |
Co-authored-by: Andrew Smith <[email protected]>
0728ed8 to
9b84256
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR restricts the --stdout option to only work with single file processing, exiting with error code 2 if used with multiple files or directories. This addresses edge cases where stdout output would be ambiguous or unhelpful.
Changes:
- Added validation to reject
--stdoutusage with multiple files or directories - Updated test fixtures from
.mdto.logformat for stdout tests - Added new test case to verify error handling when
--stdoutis used with a directory - Updated README documentation to clarify
--stdoutlimitation
Reviewed changes
Copilot reviewed 4 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| doctoc.js | Adds validation logic to exit with error code 2 when --stdout is used with multiple files or directories |
| test/transform-stdout.js | Updates fixture file references from .md to .log and adds test for directory error case |
| test/fixtures/stdout.log | New fixture file containing expected stdout output for single file processing |
| test/fixtures/stdout_run_on_directory.log | New fixture file (appears unused) showing directory processing output |
| test/fixtures/invalid_stdout/readme.md | New test fixture directory with sample markdown file for testing error case |
| README.md | Documents that --stdout only works with single files |
| .gitignore | Adds exception to allow .log files in test/fixtures directory |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This ensures that the stdout option is only being used when a single file is being processed. If not a single file, switch to dryrun and log the switch.
Closes #112
Further adjustments to stdout will be handled via #296